System and methods for determining attributes for arithmetic operations with fixed-point numbers

ABSTRACT

In a computational device, a method is provided for determining attributes for results of arithmetic operations with fixed-point numbers, in an environment for fixed-point algorithm development. An indication is received of a plurality of possible word lengths to be used for storing a plurality of digits representing a result of arithmetic operation with fixed-point numbers. An indication is received of how a placement of a radix point is to be determined in the plurality of digits representing the results of the arithmetic operation with fixed-point numbers. When calculating a selected fixed-point arithmetic operation, one of the word lengths in the plurality of possible word lengths is employed for storing the plurality of digits representing a result of the selected fixed-point arithmetic operation. A placement of a radix point in the plurality of digits representing the result of the selected fixed-point arithmetic operation is based on the received indication of how the radix point is to be determined.

FIELD OF THE INVENTION

The present invention relates to a system and method for determining attributes for arithmetic operations with fixed-point numbers, and, in particular, for determining attributes for arithmetic operations with fixed-point numbers in an environment for fixed-point algorithm development.

BACKGROUND

In conventional environments for fixed-point algorithm development, a user may have a number of options regarding how the precision of fixed-point numbers is handled for arithmetic operations. These options may be designated as “full precision” and “specify precision.” With the “full precision” option, a computational tool automatically calculates how many digits are needed to retain full precision of the result of the operation and uses a word length that accommodates the number of digits needed to retain full precision of the result of the operation. The minimum word length and radix point of the result of the operation are automatically determined so that no loss of precision or overflow will occur. This level of specification minimizes the need for the user to specify a multitude of changing attributes when emulating calculation of a fixed-point arithmetic operation on a particular machine but often leads to attributes that are not realizable on the emulated machine.

With the “specify precision” option, a word length and radix point for results of fixed-point arithmetic operations are specified by the user. This level of specification typically allows the user to exactly emulate calculation of a fixed-point arithmetic operation on a particular machine, but may place a burden on the user to calculate all attributes, even where the attributes are subject to frequent change.

Unfortunately, conventional environments lack a method for specifying any level of specification between full specification by the user and full precision by the computational tool. Additionally, conventional simulation environments typically lack a method for relieving the burden on the user of specifying all attributes without requiring full precision by a computational tool, which may result in attributes that are not realizable on a given architecture.

SUMMARY OF THE INVENTION

The present invention greatly relieves the burden of specification of fixed-point attributes in fixed-point algorithm development, while simultaneously providing the ability to get the same results as any practical fixed-point algorithm in a faithful manner. Fixed-point arithmetic behavior is determined by the attributes of the fixed-point operands, coupled with arithmetic rules. The present innovation provides rules for setting attributes of fixed-point arithmetic operations that differ from conventional options. In a first conventional option, a user specifies all of the attributes of the results of fixed-point operations and this puts a difficult burden on the user. In a second conventional option, a computational tool always keeps full precision but this often results in attributes that are not realizable on a given architecture because the word length required for full precision grows too large to be stored in the given architecture. Intermediate rules like those provided by embodiments of the present invention allow the user to specify the boundaries and behavior that exactly emulate a fixed-point machine (either real or imagined) with a minimum amount of specification. These methods greatly enhance the ease of fixed-point algorithm development. The methods can be applied broadly to all fixed-point algorithm development.

The illustrative embodiment of the present invention allows determination of attributes for results of arithmetic operations with fixed-point numbers. In an environment for fixed-point algorithm development, an indication of a plurality of possible word lengths to be used for storing a plurality of digits representing a result of an arithmetic operation with fixed-point numbers is received. An indication of a manner of determining a placement of a radix point in the plurality of digits representing the result of arithmetic operations with fixed-point numbers may also be received. One of the word lengths is employed and a placement of a radix point is determined responsive to the indication received. The illustrative embodiment of the present invention also allows for prevention of overflow in performing arithmetic operations with fixed-point numbers in an environment for fixed-point algorithm development. The present invention also allows for prevention of loss of precision in performing arithmetic operations with fixed-point numbers in an environment for fixed-point algorithm development.

In one aspect of the present invention, a method for determining attributes for results of arithmetic operations with fixed-point numbers, in an environment for fixed-point algorithm development, includes the step of receiving an indication of a plurality of possible word lengths to be used for storing a plurality of digits representing a result of an arithmetic operation with fixed-point numbers. An indication of how a placement of a radix point is to be determined in the plurality of digits representing the result of the arithmetic operation with fixed-point numbers is also received. When calculating a selected fixed-point arithmetic operation, one of the word lengths in the plurality of possible word lengths is employed for storing the plurality of digits representing the result of the selected fixed-point arithmetic operation. When calculating the selected fixed-point arithmetic operation, a placement of a radix point in the plurality of digits representing the result of the selected fixed-point arithmetic operation is determined based on the received indication of how the placement of the radix point is to be determined.

In one embodiment, a selection is made of a word length for a second word storing a result of evaluating a subsequent selected fixed-point arithmetic operation, responsive to the employed word length. In another embodiment, a plurality of possible word lengths containing a single word length is received. In still another embodiment, a plurality of possible word lengths containing a vector of word lengths is received. In yet another embodiment, an indicator of a length of used space remaining in the word is stored.

In another aspect, the invention relates to a system for determining attributes for results of arithmetic operations with fixed-point numbers in an environment for fixed-point algorithm development, including an indicator, a result, and an evaluation component. The indicator indicates a word length. The result comprises a plurality of digits representing a result of evaluating a fixed-point arithmetic operation. The evaluation component determines a placement of a radix point in the plurality of digits representing the result, responsive to the indicator of word length, and determines to store, responsive to the placement of the radix point, at least one of the plurality of digits in a word having a length responsive to the received indicator of word length.

In one embodiment, the indicator comprises a plurality of possible word lengths containing a single word length. In another embodiment, the indicator comprises a plurality of possible word lengths containing a vector of word lengths.

In one embodiment, the evaluation component stores an indicator of a length of used space remaining in the word that is occupied by digits representing the results. The evaluation component may select, responsive to a number of used digits in a word length of the word, a word length for a second word storing a plurality of digits representing a result of evaluating a subsequent fixed-point arithmetic operation in the second word. In another embodiment, the evaluation component determines to select an increased word length for the word. In one embodiment, the evaluation component determines to select an increased word length for the second word. In some embodiments, the evaluation component determines to store a most significant digit after determining the placement of the radix point in the result. In other embodiments, the evaluation component determines to store a least significant digit after determining the placement of the radix point in the result. In some embodiments, the system includes a user interface for receiving the indicator of word length and the result.

In one aspect, the invention relates to a medium in an electronic device holding executable steps for a method for determining attributes for results of arithmetic operations with fixed-point numbers in an environment for fixed-point algorithm development. The method includes the step of receiving an indication of a plurality of possible word lengths to be used for storing a plurality of digits representing a result of an arithmetic operation with fixed-point numbers. An indication of how a placement of a radix point is to be determined in the plurality of digits representing the result of an arithmetic operation with fixed-point numbers is also received. When calculating a selected fixed-point arithmetic operation, one of the word lengths in the plurality of possible word lengths is employed for a storing a plurality of digits representing the result of the selected fixed-point arithmetic operation. When calculating a selected fixed-point arithmetic operation, a placement of a radix point in the plurality of digits representing the result of the selected fixed-point arithmetic operation is also determined, based on the received indication of how the placement of the radix point is to be determined.

In another aspect, the invention relates to a method for determining attributes for results of arithmetic operations with fixed-point numbers, in an environment for fixed point algorithm development. The method includes the step of receiving an indication of a plurality of possible scaling factors to be used in storing a plurality of digits representing a result of an arithmetic operation with fixed-point numbers. An indication is received as to how to determine a word length for a word storing the plurality of digits representing the result of the arithmetic operation with fixed point numbers. When calculating a selected fixed-point arithmetic operation, one of the scaling factors in the plurality of possible scaling factors is employed in storing the plurality of digits representing the result of the selected fixed-point arithmetic operation. A word length is determined for the word storing the plurality of digits representing the result of the selected fixed-point arithmetic operation, based on the received indication of how the word length of the word is to be determined.

In another aspect, the invention relates to a system for determining attributes for results of arithmetic operations with fixed-point numbers, in an environment for fixed-point algorithm development. The system includes an indicator, a result, and an evaluation component. The indicator indicates a scaling factor. The result indicates the result of evaluating a fixed-point arithmetic operation and comprises a plurality of digits. The evaluation component determines a word length for a word storing the plurality of digits representing the result of evaluating the fixed-point arithmetic operation, based on the received indicator of scaling factor, and determines to store at least one of the plurality of digits in the word, responsive to the indicator of scaling factor. In one embodiment, the indicator comprises a plurality of possible scaling factors. In some embodiments, the system includes a user interface for receiving the indicator of scaling factor and the result.

In still another aspect, the invention relates to a method for determining attributes to prevent overflow in performing arithmetic operations with fixed-point numbers in an environment for fixed-point algorithm development. A plurality of word lengths is received, to be used when storing a plurality of digits representing a result of an arithmetic operation on at least one operand. Information associated with the at least one operand is received, the information comprising a number of digits used to store, in a first word, a plurality of digits representing the at least one operand. A determination is made to store the plurality of digits representing the result of evaluating the arithmetic operation on the at least one operand, in a second word having a word length selected from one of the plurality of received word lengths, responsive to the received information. An indicator is stored as to the number of digits stored in the second word. In one embodiment, a determination is made to choose a longer word length for the length of the second word responsive to the received information.

In still another aspect, the invention relates to a method for determining attributes to prevent loss of precision in performing arithmetic operations with fixed-point numbers in an environment for fixed-point algorithm development. A word length to be used for storing fixed-point numbers is received. A request for prevention of loss of precision when storing a result of evaluating an arithmetic operation with fixed-point numbers is received. A placement for a minimum radix point in the result of evaluating the arithmetic operation on fixed-point numbers is automatically calculated responsive to the received word length, said placement responsive to the request for prevention of loss of precision. A word stores a plurality of digits representing the result of evaluating the arithmetic operation, responsive to the request for preventing loss of precision. In one embodiment, an indicator of a number of radix places to preserve is received. In another embodiment, a plurality of possible word lengths containing a vector of word lengths is received.

In yet another aspect, the invention relates to a method for determining attributes to prevent overflow when performing arithmetic operations with fixed-point numbers in an environment for fixed-point algorithm development. A word length to be used for storing fixed-point numbers is received. A request is received to prevent overflow when storing a result of evaluating an arithmetic operation with fixed-point numbers. A placement for a maximum radix point in the result of evaluating the arithmetic operation on fixed-point numbers is automatically calculated responsive to the received word length, said placement preventing overflow. A word stores a plurality of digits representing the result of evaluating the arithmetic operation, responsive to the request to prevent overflow and to the received word length. In one embodiment, a plurality of possible word lengths containing a vector of word lengths is received.

BRIEF DESCRIPTION OF THE DRAWINGS

These and other aspects of this invention will be readily apparent from the detailed description below and the appended drawings, which are meant to illustrate and not to limit the invention, and in which:

FIG. 1 is a block diagram depicting one embodiment of a system for determining an attribute for a result of an arithmetic operation;

FIG. 2 is a flow diagram depicting one embodiment of the invention in which an attribute for a result of an arithmetic operation is determined;

FIG. 3 is a flow diagram depicting a second embodiment of the invention in which an attribute for a result of an arithmetic operation is determined;

FIG. 4 is a flow diagram depicting one embodiment of the invention in which an attribute preventing overflow of an arithmetic operation is determined;

FIG. 5 is a flow diagram depicting one embodiment of the invention in which an attribute preventing loss of precision of an arithmetic operation is determined; and

FIG. 6 is a flow diagram depicting a second embodiment of the invention in which an attribute preventing overflow of an arithmetic operation is determined.

DETAILED DESCRIPTION OF THE INVENTION

The illustrative embodiment of the present invention concerns arithmetic operations with fixed-point numbers, such as in environments for fixed-point algorithm development, provided on a computational device. The illustrative embodiment of the present invention provides support for determining attributes for results of arithmetic operations with fixed-point numbers. The illustrative embodiment provides intermediate options that do not rely solely on the user or solely on the computational device to specify attributes of fixed-point arithmetic. The present invention provides scaling of fixed-point numbers to avoid overflow conditions and minimize quantization errors, and includes options for binary point-only or power-of-two scaling, as well as encoding schemes for non-binary points.

Several options are provided in the illustrative embodiment, although those skilled in the art will appreciate that other options are encompassed by the present invention. In a first option, full precision is ensured and fixed minimal word lengths are used. The word length is restricted to be one of a vector of available word lengths specified by a user. Alternatively, the scaling factor is restricted to be one of a vector of available scaling factors specified by a user. Either the word length or the placement of the radix point are automatically determined so that no overflow occurs. In a second option, the user specifies word length and the placement of a minimum radix point is automatically determined such that no loss of precision occurs. Hence, with this option, the least significant digits are preserved. In a third option, the user chooses the word length and the placement of a maximum radix point is automatically determined so that no overflow occurs, and thus the most significant digits are stored.

Before continuing with the discussion below, it is helpful to first define the use of a few terms.

The term “fixed-point representation” refers to a method for representing numerical values and data types that have a set range and precision. Fixed-point numbers can be represented as real-world value=(slope×integer)+bias, where the slope can be expressed as slope=fractional slope×2^(exponent). The slope and the bias together represent the scaling of the fixed-point number. Fixed-point data types can be defined by their word length, their fraction length, and whether they are signed or unsigned

The phrase “result of an arithmetic operation with fixed-point numbers” refers to the full-precision result of evaluating an arithmetic operation on fixed-point representations of one or more operands. The result may comprise a plurality of bits and one or more of those bits may be selected to represent the entire result when the result is stored in a word.

The term “precision” refers to a measure of the smallest numerical interval that a fixed-point data type and scaling can represent, determined by the value of the number's least significant bit. The precision is given by the slope, or the number of fractional bits. The term resolution is sometimes used as a synonym for this definition. The precision of a fixed-point number is the difference between successive values representable by its data type and scaling, which is equal to the value of its least significant bit. The value of the least significant bit, and therefore the precision of the number, is determined by the number of fractional bits. A fixed-point value can be represented to within half of the precision of its data type and scaling. For example, a fixed-point representation with four bits to the right of the binary point has a precision of 2⁻⁴ or 0.0625, which is the value of its least-significant bit. Any number within the range of this data type and scaling can be represented to within (2⁻⁴)/2 or 0.03125, which is half the precision. This is an example of representing a number with finite precision.

The term “scaling factor” refers to a format used for a fixed-point number of a given word length and signedness. The slope and bias together form the scaling of a fixed-point number having a scale factor. Fixed-point numbers can be encoded according to the scheme: real-world value=(slope×integer)+bias, where the slope can be expressed as: slope=fractional slope×2^(fixed exponent). The integer is sometimes called the stored integer. This is the raw number, in which the radix point assumed to be at the far right of the word. The negative of the fixed exponent may be referred to as the fraction length. The slope and bias together represent the scaling of the fixed-point number. In a number with zero bias, only the slope affects the scaling. A fixed-point number that is only scaled by binary point position is equivalent to a number in Slope-Bias representation that has a bias equal to zero and a fractional slope equal to one. This is referred to as binary point-only scaling or power-of-two scaling: real-world value=integer×2^(fixed exponent) or real-world value=integer×2^(−fraction length)

The present invention supports both binary point-only scaling and [Slope Bias] scaling. Although typical systems use binary number representations, the methods described below are not restricted to a particular physical implementation. In some embodiments, the methods described below may be applied to any number representation and to any number base. In other embodiments, the methods may be applied to operations involving a mix of fixed-point and floating-point operands.

FIG. 1 shows a block diagram of one embodiment of a system for determining an attribute for a result of an arithmetic operation. In one embodiment, the system resides on a computational device. Examples of a computational device include personal computer, network computer, workstation, or server. A computational device suitable for practicing the illustrative embodiment has a processor and storage. Furthermore, a fixed-point algorithm development environment is running on the processor. One example of such an environment is MATLAB® from The Mathworks, Inc., of Natick, Mass. Another example of such an environment is LabVIEW™ from National Instruments Corporation, of Austin, Tex. A copy of MATLAB®, LabVIEW™ or other such environments, may reside in the storage element of the computational device.

The system includes an evaluation component 104, an indicator 106, and a result 108. In some embodiments, the system includes a user interface. The user interface 102 may receive the indicator 106 and the result 108. The user interface 102 may comprise a command line interface. In another embodiment, the user interface 102 comprises a graphical user interface. The result 108 comprises a plurality of digits representing a result of evaluating a fixed-point arithmetic operation.

The indicator 106 may indicate a word length. As part of developing a fixed-point algorithm, an indicator of word length 106 may be stored in the storage element of the computational device. The indicator 106 specifies a plurality of possible word lengths for storing a plurality of digits representing a result of an arithmetic operation with fixed-point numbers. These fixed-point numbers may be results of fixed-point arithmetic operations. In one embodiment, the indicator 106 comprises a plurality of possible word lengths containing a single word length, indicating that a single word length may be used. In another embodiment, the indicator 106 comprises a plurality of possible word lengths containing a vector of word lengths, indicating that word lengths are limited to the length of the values in the set. The modes provided by an illustrative embodiment of the present invention enable a user to specify attributes of results of fixed-point arithmetic operations. In particular, they enable a user to specify how word length is to be set and to select how the computational device will determine the placement of the radix point in the plurality of digits representing the result of the arithmetic operation with fixed-point numbers. Thus, for such an arithmetic operation, the storage element will hold the result in words having word lengths dictated by the user and having radix points whose placements are determined by the computational device.

The evaluation component 104, which may be in communication with a user interface 102, determines a placement of a radix point in the result 108, responsive to the indicator 106 of how the placement of the radix point is to be determined, and determines to store, responsive to the determined placement of the radix point, at least one of the plurality of digits in a word 110, said word 110 having a length responsive to the received indicator 106 of word length. In one embodiment, the evaluation component 104 selects a word 110 in which to store at least one of a plurality of digits representing a result of evaluating an arithmetic operation with fixed-point numbers. The evaluation component 104 may alternatively select a word 110 having a length responsive to an indication of a fixed set of word lengths in the indicator 106. In some embodiments, the evaluation component 104 selects a word 110 having a length responsive to the indicator 106. The evaluation component 104 may store at least one of the most-significant digits in the plurality of digits representing the result 108. Alternatively, the evaluation component 104 may store at least one of the least-significant digits in the plurality of digits representing the result 108. In some embodiments, the evaluation component 104 selects a word 110 having a length responsive to a request to preserve a level of precision of the result 108.

The evaluation component 104 may select, responsive to the word 110, a word length for a second word storing a plurality of digits representing a result of evaluating a subsequent fixed-point arithmetic operation in the second word. In some embodiments, the evaluation component 104 stores an indicator of a length of used space remaining in the word 110. The length of the used space may be the number of digits in the word 110 occupied by stored digits representing the result of evaluating a first fixed-point arithmetic operation. In one of these embodiments, the evaluation component 104 compares the number of digits used in the word 110, as indicated by the indicator of the length of used space, with the result of evaluating the subsequent fixed-point arithmetic operation. The evaluation component 104 may determine to select for the second word a word length longer than the length of the word 110 after comparing the number of digits used in the word with the length of the word 110. Choosing a longer word length for the second word may ensure that there are sufficient digits available for storing the result of evaluating the subsequent fixed-point arithmetic operation in word 110.

In one embodiment, the indicator 106 indicates a scaling factor. The user interface 102 receives the indicator of scaling factor and the result. The evaluation component 104 determines a word length for a word 110 storing the plurality of digits representing the result 108 of evaluating the fixed-point arithmetic operation, based on the received indicator 106 of scaling factor, and for determining to store at least one of the plurality of digits in the word 110, responsive to the indicator 106 of scaling factor.

FIG. 2 shows a flow diagram for one embodiment of the invention in which an attribute for a result of an arithmetic operation is determined. In a computational device, a method is provided for determining attributes for results of arithmetic operations with fixed-point numbers, in an environment for fixed-point algorithm development. An indication is received of a plurality of possible word lengths to be used for storing a plurality of digits representing a result of an arithmetic operation with fixed-point numbers (step 202). The indication may be received from a user. The user may transmit the indicator 106 to the system via the user interface 102. In some embodiments, the plurality of possible word lengths contains a single word length. In other embodiments, the plurality of possible word lengths contains a vector of word lengths. In still other embodiments, the word length may be expressed as a formula. In addition to receiving the indication, a request may also be received to preserve a level of precision when storing the result.

An indication is received of how a placement of a radix point in the plurality of digits representing the result of the arithmetic operation with fixed-point numbers is to be determined (step 204). A user may indicate how the placement of the radix point is to be determined. In one embodiment, the user indicates that the placement of the radix point should be determined such that no overflow occurs. In another embodiment, the user indicates that the placement of the radix point should be determined such that no loss of precision in the digits representing the result of the arithmetic operation occurs. In still another embodiment, the placement of the radix point is determined automatically.

One of the word lengths in the plurality of possible word lengths is employed for storing the plurality of digits representing the result of a selected fixed-point arithmetic operation when calculating the selected fixed-point arithmetic operation (step 206). In one embodiment, the word has a length selected responsive to a request to preserve the level of precision of the result. In another embodiment, the word has a length selected responsive to a request to prevent overflow when storing the result. In still another embodiment, the word has a length selected responsive to a characteristic of an operand used in evaluating the selected fixed-point arithmetic operation.

A placement of a radix point in the plurality of digits representing the result of the selected fixed-point arithmetic operation is determined based on the received indication of how the placement of the radix point is to be determined, when calculating a selected fixed-point arithmetic operation (step 208). A plurality of digits may represent a result of a selected fixed-point arithmetic operation. In one embodiment, a determination is made to store at least one of the plurality of digits in a word. In another embodiment, a determination is made to store either the most-significant digits or the least-significant digits of the result.

In some embodiments, an indicator of a length of used space used in the word is stored. The indicator identifies a number of digits used after storing the plurality of digits representing the result in the word. A determination is made as to whether to store a result of evaluating a subsequent selected fixed-point arithmetic operation in a second word having a word length of the same length as the word length of the first word, responsive to the indicator of the length of used space remaining in the word. The indicator of the length of used space remaining in the word may be used to determine whether, based on the number of digits in the word given the employed word length, there would be sufficient digits remaining in the second word to store the subsequent result. In one embodiment, a longer word length is chosen from the fixed set of possible word lengths for the length of the second word. In these embodiments, the result of evaluating the subsequent selected fixed-point arithmetic operation may then be stored in the second word since the increased word length ensures sufficient digits are available for storing the subsequent result.

FIG. 3 is a flow diagram depicting a second embodiment of the invention in which an attribute of an arithmetic operation is determined. An indication is received of a plurality of possible scaling factors to be used in storing a plurality of digits representing a result of an arithmetic operation with fixed-point numbers (step 302). In one embodiment, the plurality of possible scaling factors contains a single scaling factor. In other embodiments, the plurality of possible scaling factors contains a vector of scaling factors.

An indication is received of how a word length is to be determined for a word storing the plurality of digits representing the result of the arithmetic operation with fixed-point numbers (step 304). A user may indicate how the word length is to be determined. In one embodiment, the user indicates that the word length should be determined such that no overflow occurs. In another embodiment, the user indicates that the word length should be determined such that no loss of precision in the digits representing the result of the arithmetic operation occurs.

When calculating a selected fixed-point arithmetic operation, one of the scaling factors in the plurality of possible scaling factors is employed in storing the plurality of digits representing the result of the selected fixed-point arithmetic operation (step 306). The scaling factor chosen may result in storage of the most significant digits of the result in the word. Alternatively, the scaling factor chosen may result in storage of the least significant digits of the result.

When calculating a selected fixed-point arithmetic operation, a word length is determined for the word storing the plurality of digits representing the result of the selected fixed-point arithmetic operation, based on the received indication of how the word length of the word is to be determined (step 308). A plurality of digits may represent a result of a selected fixed-point arithmetic operation. In one embodiment, a determination is made to store at least one of the plurality of digits in a word. In another embodiment, a determination is made to store either the most-significant digits or the least-significant digits of the result. In some embodiments, selecting the digits stored is responsive to a request for preventing overflow. In other embodiments, selecting the digits stored is responsive to a request for preserving precision.

FIG. 3 describes a method for selecting a word length given a scaling factor. The following is an example of syntax for arithmetic operations including a product operation and for a sum operation performed in this mode, in an environment used by a Fixed-Point Toolbox in MATLAB® from The Mathworks, Inc., of Natick, Mass.:

Suppose the scaling of the least-significant bit is fixed at 2⁻⁴, and the set of allowable word lengths is {8, 16, 24, 32, 40}. Let the rules for determining the attributes of the result of an arithmetic operation be defined by:

(a′) If any of the operands is signed, then the result shall be signed.

(b′) The number of digits in the word that stores the variable shall be chosen from the set {8, 16, 24, 32, 40}.

(c′) If the result can be represented without overflow in a word length that is in the set of allowable word lengths, then choose the smallest word length from the set that can represent the result without overflow, and store the result in the least-significant bits of a word of that length. (d′) If the result cannot be represented without overflow in a word length that is in the set of allowable word lengths, then choose the largest word length from the set, and store up to that number of least-significant bits of the result in a word of that length. (e′) The scaling of the least-significant bit of the result shall be 2⁻⁴.

Let variable C be:

(1) signed;

(2) stored in an 8-bit word with 2⁻⁴ scaling of its least-significant bit;

(3) given that 7 bits out of the 8 are used with 2⁻⁴ scaling of the least-significant bit of the used bits; and

(4) given that the value of the binary digits is

${00110010\; \times 2^{- 4}} = {3.125 \approx \underset{.}{\pi}}$ rounded to 7 bits. For this illustration, the 7 used bits have been highlighted by enclosing them in a box.

Let variable D be:

(1) signed;

(2) stored in an 8-bit word with 2⁻⁴ scaling of its least-significant bit;

(3) given that 7 bits out of the 8 are used with 2⁻⁴ scaling of the least-significant bit of the used bits; and

(4) given that the value of the binary digits is

00101011  × 2⁻⁴ = 2.6875 ≈ e rounded to 7 bits. For this illustration, the 7 used bits have been highlighted by enclosing them in a box.

Given the definitions of variables C and D from above, and the rules of arithmetic described in (a′)-(e′) from above, the following results for the sum S=C+D, and the product P=C×D can be determined.

The result S=C+D will:

-   -   be signed because both C and D are signed;     -   be stored in an 8-bit word because the full-precision result         requires 4 integer bits to prevent overflow and (e′) requires 4         fractional bits, we need at least 8 bits for the result, and 8         is in the set of allowable word lengths {8, 16, 24, 32, 40};     -   have scaling 2⁻⁴ from requirement (e′);     -   store the knowledge that 8 bits were used, and the scaling of         the least-significant bit of the used bits is 2⁻⁴;     -   have the value

S = 01011101  × 2⁻⁴ = 5.8125, where the 8 used bits have been highlighted for this illustration by enclosing them in a box.

-   -   -   The result P=C×D will:

    -   be signed because both C and D are signed;

    -   be stored in a 16 bit word because the full-precision result         requires 6 integer bits to prevent overflow and since (e′)         requires 4 fractional bits, we need at least 10 bits for the         result, and 16 is the next higher word length in the set of         allowable word lengths {8, 16, 24, 32, 40};

    -   have scaling 2⁻⁴ from requirement (e′);

    -   store the knowledge that 10 bits were used, and the scaling of         the least-significant bit of the used bits is 2⁻⁴;

    -   have the value

P = 0000000010000110  × 2⁻⁴ = 8.375, where the 10 used bits have been highlighted for this illustration by enclosing them in a box.

FIG. 4 is a flow diagram depicting one embodiment of the invention in which an attribute preventing overflow of an arithmetic operation is determined. In a computational device, a plurality of word lengths is received for use when storing a plurality of digits representing a result of an arithmetic operation on at least one operand (step 402). The plurality of word lengths may comprise a vector of word lengths. Each word length may indicate a number of available digits in which a word may store one or more digits representing a result of evaluating a first arithmetic operation.

Information associated with the at least one operand is received, the information comprising a number of digits used to store, in a first word, a plurality of digits representing the at least one operand (step 404). In some embodiments, a plurality of digits representing the at least one operand is received, the plurality of digits chosen to represent the least significant digits of the operand. The plurality of digits representing the at least one operand may alternatively represent the most significant digits of the operand.

In one embodiment, the information indicates whether the operand is a signed variable, containing a positive number, a negative number, or zero, or an unsigned variable, containing a positive number or zero. In another embodiment, the information indicates the number of digits in the word that stores the operand and the scaling of the least-significant digit of the word that stores the operand. In still another embodiment, the information indicates the number of digits used and the scaling of the least-significant digit of the used digits. The scaling of the least-significant digit of the used digits may or may not be the same as the scaling of the least-significant digit of the word that stores the variable. The location of the used digits within the word that stores the variable is a function of the scaling of the used digits. Hence, the location of the used digits can be derived from the number of digits used and the scaling of the used digits. The number of used digits must be at least as large as the number of digits in the word that stores the variable. In the case of signed representations, the most significant unused digits of the stored word may be sign extended (for example, in two's-complement binary representations). In yet another embodiment, the information indicates the value of the digits in the word that stores the operand.

A determination is made to store the plurality of digits representing the result of evaluating the arithmetic operation on the at least one operand, in a second word having a word length selected from one of the plurality of received word lengths, responsive to the received information (step 406). The attributes of the result of an arithmetic operation on one or more operands, and the attributes of the second word storing the result, may be a function of the number of digits used to store the operands and the scaling of the least-significant digit of the used digits. The attributes of a result may be further influenced by other rules, such as choosing the stored word length from a set of allowable word lengths, keeping the most-significant digits of the result, or keeping the least-significant digits of the result. These rules may be used individually or in conjunction with one another.

In one embodiment, a word length is selected from one of the plurality of word lengths having a length at least as long as the number of digits used to store the plurality of digits representing the at least one operand. In some embodiments, a selection is made for the word length from one of a plurality of word lengths responsive to a determined minimum effective word length.

A determination may be made to store the plurality of digits representing the result of evaluating the arithmetic operation on the at least one operand, in a second word having a longer word length than the length needed to store the plurality of digits representing the at least one operand. In other embodiments, a determination is made as to whether the word length of the plurality of digits representing the result of evaluating the arithmetic operation on the at least one operand exceed the length of the longest word length in the received plurality of word lengths. If the longest word length available from the received plurality of word lengths is not capable of storing all of the plurality of digits representing the result, a determination may be made to store the plurality of digits representing the least significant digits of the result. For example, if a full-precision result is 50 bits, and the maximum word length in the finite set of word lengths is 40, then the most-significant 40 bits of the result are stored in a 40 bit word. The determination may also be made to store the plurality of digits representing the most significant digits of the result. For example, if a full-precision result is 50 bits, and the maximum word length in the finite set of word lengths is 40, then the least-significant 40 bits of the result are stored in a 40 bit word.

An indicator is stored of the length of the digits stored in the second word (step 408). In one embodiment, the digits stored in the second word may be used as an operand in a subsequent arithmetic operation. In this embodiment, the indicator may be sent as the information about the at least one operand.

In some embodiments, a minimum effective word length is determined when selecting the word length of the word. The determination of the minimum effective word length may be made responsive to the number of digits in the result of evaluating the arithmetic operation. The determination of the minimum effective word length may also be made responsive to a word length in the plurality of received word lengths. In one embodiment, the selection of a word length from the plurality of word lengths is made responsive to the determined minimum effective word length.

In one embodiment of the present invention, a system of arithmetic is binary-point scaling with two's-complement binary arithmetic. Given two operands, A and B, variable A may be:

(1) signed;

(2) stored in a signed 16-bit word with 2⁻⁷ scaling of its least-significant bit;

(3) given that 8 bits out of the 16 are used with 2⁻⁷ scaling of the least-significant bit of the used bits; and

(4) given that the value of the binary digits is

0000000001100101  × 2⁻⁷ = 0.78125 ≈ π/4 rounded to 8 bits. For this illustration, the 8 used bits have been highlighted by enclosing them in a box.

Variable B may be:

(1) signed;

(2) stored in a signed 16-bit word with 2⁻⁷ scaling of its least-significant bit;

(3) given that 10 bits out of the 16 are used with 2⁻⁷ scaling of the least-significant bit of the used bits is; and

(4) given that the value of the binary digits is

0000000101011100  × 2⁻⁷ = 2.71875 ≈ e rounded to 10 bits. For this illustration, the 10 used bits have been highlighted by enclosing them in a box.

The rules for determining the attributes of the result of an arithmetic operation are as follows:

(a) If any of the operands is signed, then the result shall be signed.

(b) The number of digits in the word that stores the variable shall be chosen from the set {8, 16, 24, 32, 40}.

(c) If the result can be represented without loss of precision in a word length that is in the set of allowable word lengths, then choose the smallest word length from the set that can represent the result in full precision, and store the result in the least-significant bits of a word of that length. (d) If the result cannot be represented without loss of precision in a word length that is in the set of allowable word lengths, then choose the largest word length from the set, and store up to that number of least-significant bits of the result in a word of that length.

Given the definitions of variables A and B from above, and the rules of arithmetic described in (a)-(d) from above, the following results for the sum S=A+B, and the product P=A×B can be determined.

The result S=A+B will

-   -   be signed because both A and B are signed;     -   be stored in a 16-bit word with scaling 2⁻⁷ because the minimum         word length for the full-precision sum requires 11 bits and 16         bits is the next word length in the set of allowable word         lengths {8, 16, 24, 32, 40}, and the scaling is 2⁻⁷ because the         result is to be stored in the least-significant bits;     -   store the knowledge that 11 bits were used, and the scaling of         the used bits is 2⁻⁷;     -   have the value

S = 0000000111000001  × 2⁻⁷ = 3.5078125, where the 11 used bits have been highlighted for this illustration by enclosing them in a box.

The result P=A×B will

-   -   be signed because both A and B are signed;     -   be stored in a 24-bit word with scaling 2⁻¹⁴ because the minimum         word length for the full precision product requires 18 bits and         24 bits is the next word length in the set of allowable word         lengths {8, 16, 24, 32, 40}, and the scaling is scaling 2⁻¹⁴         because the result is to be stored in the least-significant         bits;     -   store the knowledge that 18 bits were used, and the scaling of         the used bits is 2⁻¹⁴;     -   have the value

P = 000000001000100101001100  × 2⁻¹⁴ = 2.145263671875, where the 18 used bits have been highlighted for this illustration by enclosing them in a box.

The embodiment described above illustrates a rule that computes the fixed-point attributes of evaluating a result of an arithmetic operation responsive to the fixed-point attributes of the operands, without regard to the values of the operands. In other embodiments, a rule may compute the fixed-point attributes of a result based on the values of the operands. For example, given two unsigned four-bit operands, E=0001×2⁰=1 and F=0010×2⁰=2, then using the knowledge of the values of E and F, the sum E+F=11×2⁰=3 may be expressed in two bits, and the product E×F=10×2⁰=2 may also be expressed in two bits.

The embodiment depicted by FIG. 4 may, in some embodiments, be described as “Stepped Precision, Minimum Steps.” In practice, an embodiment of the method described in FIG. 4 is very useful when applied to a series of arithmetic operations. For example, when a sum is carried out in series, A+B+C, the first intermediate sum S₁=A+B is computed and stored in a word, and the number of used digits and scaling is stored. Then, when the subsequent sum is computed, S₂=S₁+C, the number of used digits and scaling in S₁ can be utilized to determine a minimum representation for S₂. The following is an example of syntax for such a series of arithmetic operations including a product operation and for a sum operation performed in this mode, in an environment used by a Fixed-Point Toolbox in MATLAB® from The Mathworks, Inc., of Natick, Mass.:

Binary Decimal Type Minimum Type A 011.00101 3.15625 S8, 5 S8, 5 B 010.10111 2.71875 S8, 5 S8, 5 C 0.1110011 0.898438 S8, 7 S8, 7 a * b 001000.1001010011 8.58105 S16, 10 S16, 10 (a * b) * c 000000000000111.10110101101001001 7.70954 S32, 17 S24, 17 a + b 00000000101.11100 5.875 S16, 5  S9, 5 (a + b) + c 000000110.1100011 6.77344 S16, 7  S12, 7 

In this embodiment, a user has defined fixed-point variables a, b, and c. Each variable is stored as signed (true), with 8-bit word lengths. None of the variables a, b, or c specify the number of fractional bits to use, and so the number of fractional bits is chosen to maximize precision and avoid overflow. Variable a approximates π to 8 bits of precision. Variable b approximates e to 8 bits of precision. Variable c approximates 0.9 to 8 bits of precision. The product abc needs a 24-bit word length to represent the value exactly, so it the word length is stepped up to 32 bits and it is remembered that only 24 bits of the 32 available bits are needed. The 24-bit minimum word length is used to calculate the word length for the next operation.

The sum a+b needed a 9-bit word length to represent the value exactly, and it stepped up to 16 bits and remembered that it only needed 9 bits. The 9-bit minimum word length is used to calculate the word length of the next sum (a+b)+c. The minimum word length for (a+b)+c is 12-bits (after aligning the binary points), so the next step of 16 bits is chosen.

FIG. 5 is a flow diagram depicting one embodiment of the invention in which an attribute preventing loss of precision of an arithmetic operation is determined. A word length is received from a user to be used for storing fixed-point numbers (step 502). The word length may indicate a plurality of digits in a word which are available for storage of a result of evaluating an arithmetic operation with fixed-point numbers. In some embodiments, a plurality of possible word lengths containing a vector of word lengths is received.

A request to preserve precision when storing a result of evaluating an arithmetic operation with fixed-point numbers is received (step 504). An indicator of a number of radix places to preserve may be received. In some embodiments, an indicator of which fractional digits to store from a plurality of digits representing the result of evaluating the arithmetic operation is received.

A placement for a minimum radix point in the result of evaluating the arithmetic operation on fixed-point numbers, is automatically calculated, responsive to the received word length, said placement responsive to the request for prevention of loss of precision (step 506). A placement of a minimum radix point in a result of evaluating a first arithmetic operation may be automatically calculated. If so, the word length is specified by the user and the placement of the minimum radix point is automatically determined such that the least-significant digits are stored in the word having the specified word length and no loss of precision will occur. In some embodiments, preventing loss of precision may result in overflow.

A word stores, responsive to the request to prevent loss of precision, a plurality of digits representing the result of evaluating the arithmetic operation (step 508). In one embodiment, each of the digits representing the result are stored in the word until the word overflows. In another embodiment, each of the digits representing the result are stored in the word resulting in the word having a length longer than the specified word length.

In an embodiment where the user selects a word length for a result that is not in the finite set of word lengths, the next higher word length may be used to store the result in the least significant digits, the selected word length is stored for use in a subsequent computation. For example, if the user selects 28 bits, then store the result in the least-significant 28 bits of a 32-bit word, and remember that only 28 bits were used and that they are stored in the least-significant bits. If the selected word length is larger than the largest word length in the finite set of word lengths, then the largest word length in the finite set of word lengths is used and the least significant digits of the result are stored. For example, if the user selects 50 bits, and the maximum word length in the finite set of word lengths is 40, then the least-significant 40 bits of the result are stored in a 40 bit word.

The embodiment depicted by FIG. 5 may, in some embodiments, be described as “Keep Least Significant Bits (KeepLSB) Mode.” In this mode, the word lengths are specified and the least-significant bits of results are kept. This mode models the behavior of integer operations in the C language. The following is an example of syntax for a product operation and for a sum operation performed in this mode, in an environment used by a Fixed-Point Toolbox in MATLAB® from The Mathworks, Inc., of Natick, Mass.:

Binary Decimal Type Comments a 011.00101 3.15625 s8, 5 b 010.10111 2.71875 s8, 5 a * b 00.1001010011 0.581055 s12, 10 Overflow a + b 0000101.11100 5.875 s12, 5 

In the example above, the product word-length has been specified as 12 bits to model the product register in a particular device. The product fraction-length is the sum of the fraction lengths of the operands. In this case, each operand had 5 fractional bits, so the product fraction-length is 10 bits. In this mode, all 10 fractional bits are preserved but overflow occurs because the full precision result requires 6 integer bits, and there are only 2 integer bits in the product. The sum word-length has been specified as 12 bits to model the sum register in our device. The sum fraction-length is aligned with the fraction lengths of the operands, and all least-significant-bits are kept in this mode. In this case, both operands had 5 fractional bits, so the sum has 5 fractional bits. The full precision result requires 4 integer bits, and we have 7 integer bits, so no overflow occurs in the sum.

Referring now to FIG. 6, a flow diagram depicts one embodiment of the invention in which an attribute preventing overflow is determined when performing arithmetic operations with fixed-point numbers in an environment for fixed-point algorithm development. A word length is received from a user to be used for storing fixed-point numbers (step 602). The word length may indicate a plurality of digits in a word which are available for storage of a result of evaluating an arithmetic operation with fixed-point numbers. In some embodiments, a plurality of possible word lengths containing a vector of word lengths is received.

A request is received to prevent overflow when storing a result of evaluating an arithmetic operation with fixed-point numbers (step 604). In one embodiment, the request is received from a user. A maximum number of digits representing the result are stored in the word but, due to the fixed word length for prevention of overflow, not all of the digits representing the result may be stored. Therefore, in some embodiments, preventing overflow may result in a loss of precision.

A placement for a maximum radix point in the result of evaluating the arithmetic operation on fixed-point numbers is automatically calculated (step 606). The automatic calculation may be responsive to the received word length. The placement of the maximum radix point may prevent overflow.

A word stores a plurality of digits representing the result of evaluating the arithmetic operation. The length of the word may be chosen responsive to the request to prevent overflow and to the received word length. In an embodiment where the user selects a word length for a result that is not in the finite set of word lengths, then the next higher word length may be used for the word storing the result in the most significant digits, and the selected word length is stored for use in a subsequent computation. For example, if the user selects 28 bits, then store the result in the most-significant 28 bits of a 32-bit word, and remember that only 28 bits were used and that they are stored in the most-significant bits. If the selected word length is larger than the largest word length in the finite set of word lengths, then the largest word length in the finite set of word lengths is used and the most significant digits of the result are stored. For example, if the user selects 50 bits, and the maximum word length in the finite set of word lengths is 40, then the most-significant 40 bits of the result are stored in a 40 bit word.

The embodiment depicted by FIG. 6 may, in some embodiments, be described as “Keep Most Significant Bits (KeepMSB) Mode.” In these embodiments, the word length is specified, and the most-significant bits of the results of the product or sum are kept. Precision may be lost but overflow is prevented. This mode models the behavior of many DSP devices where the product and sum are kept in double-wide registers and the programmer chooses to transfer the most-significant bits from the registers to memory after each operation. This behavior also models, for example, the Zilog Z893xx, where the multiplier accepts 16-bit operands, but produces a 24-bit result instead of the 32-bits that would be necessary for an exact product. The following is an example of syntax for a product operation and for a sum operation performed in this mode, in an environment used by a Fixed-Point Toolbox in MATLAB® from The Mathworks, Inc., of Natick, Mass.:

Binary Decimal Type Comments a 011.00101 3.15625 s8, 5 b 010.10111 2.71875 s8, 5 a * b 001000.100101 8.57812 s12, 6  Precision loss a + b 0101.11100000 5.875 s12, 8 

In the example above, a product word-length of 12 bits has been specified to model the product register in a particular device. The full-precision product requires 6 integer bits, and so the fraction length of the product is adjusted to accommodate all 6 integer bits. No overflow occurs, but precision is lost because the full-precision product requires 10 fractional bits. The sum word-length has been specified as 12 bits to model the sum register in a device. The full-precision sum requires 4 integer bits, so the fraction length of the sum is adjusted to accommodate all 4 integer bits. The full-precision sum requires only 5 fractional bits; in this case we have 8, so there is no loss of precision.

The present invention may be provided as one or more computer-readable programs embodied on or in one or more mediums. The mediums may be a floppy disk, a hard disk, a compact disc, a digital versatile disc, a flash memory card, a PROM, a RAM, a ROM, or a magnetic tape. In general, the computer-readable programs may be implemented in any programming language. Some examples of languages that can be used include C, C++, C#, or JAVA. The software programs may be stored on or in one or more articles of manufacture as object code.

While the invention has been shown and described with reference to specific preferred embodiments, it should be understood by those skilled in the art that various changes in form and detail may be made therein without departing from the spirit and scope of the invention as defined by the following claims. 

What is claimed is:
 1. In a computational device, a method for determining attributes for results of arithmetic operations with fixed-point numbers, the method comprising: receiving an indication of a plurality of possible word lengths to be used for storing a plurality of digits representing a result of an arithmetic operation with fixed-point numbers; receiving a user input indicating how a placement of a radix point is to be determined in the plurality of digits representing the result of the arithmetic operation with fixed-point numbers, where: the received user input requests to place the radix point such that a level of precision of the result of the arithmetic operation is preserved, or the received user input requests to place the radix point such that overflow is prevented when storing the result of the arithmetic operation; and calculating a selected fixed-point arithmetic operation, the calculating including: employing, using the computational device, one of the word lengths in the plurality of possible word lengths for storing the plurality of digits representing a result of the selected fixed-point arithmetic operation, the employed one of the word lengths in the plurality of possible word lengths being selected based on the request included in the received indication, and determining the placement of the radix point in the plurality of digits representing the result of the selected fixed-point arithmetic operation based on the received user input.
 2. The method of claim 1, further comprising selecting, responsive to the employed word length, a word length for storing a result of evaluating a subsequent selected fixed-point arithmetic operation.
 3. The method of claim 1, wherein receiving an indication of a plurality of possible word lengths further comprises receiving a plurality of possible word lengths containing a single word length.
 4. The method of claim 1, wherein receiving an indication of a plurality of possible word lengths further comprises receiving a plurality of possible word lengths containing a vector of word lengths.
 5. The method of claim 1, wherein calculating a selected fixed-point arithmetic operation further comprises storing an indicator of a length of used space remaining in the employed word length.
 6. The method of claim 1, further comprising increasing a length of the employed word length.
 7. The method of claim 1, wherein calculating a selected fixed-point arithmetic operation further comprises storing at least one of the plurality of digits representing the result of the selected fixed-point arithmetic operation in a word, said word having a length responsive to the request to preserve the level of precision of the result.
 8. The method of claim 1, wherein calculating a selected fixed-point arithmetic operation further comprises storing most significant digits of the result.
 9. The method of claim 1, wherein calculating a selected fixed-point arithmetic operation further comprises storing least significant digits of the result.
 10. A system comprising: a processor executing instructions for providing: an indicator of possible word lengths; a result of evaluating a fixed-point arithmetic operation, the result comprising a plurality of digits; and an evaluation component for: determining a placement of a radix point in the plurality of digits representing the result based on a user input, where: the user input requests placing the radix point such that no overflow occurs, or the user input requests placing the radix point such that no precision is lost in the result, and determining to store, responsive to the placement of the radix point, at least one of the plurality of digits in a first word, said first word having a length selected from the possible word lengths based on the input.
 11. The system of claim 10 further comprising a user interface receiving the indicator of word length and the result.
 12. The system of claim 10, wherein the user interface further comprises a command line interface.
 13. The system of claim 10, wherein the evaluation component stores an indicator of a number of digits used in the word.
 14. The system of claim 10, wherein the evaluation component selects, responsive to a number of used digits in a word length of the first word, a word length for a second word storing a plurality of digits representing a result of evaluating a subsequent fixed-point arithmetic operation in the second word.
 15. The system of claim 10, wherein the evaluation component determines to choose a longer word length for the word length of the first word.
 16. The system of claim 10 further comprising a word having a length responsive to a request to preserve a level of precision of the result.
 17. The system of claim 10, wherein the evaluation component further comprises determining to store a most significant digit of the result.
 18. The system of claim 10, wherein the evaluation component further comprises determining to store a least significant digit of the result.
 19. In an electronic device, a non-transitory medium holding executable instructions for determining attributes for results of arithmetic operations with fixed-point numbers, the non-transitory medium holding instructions for: receiving a plurality of possible word lengths to be used for storing a plurality of digits representing a result of an arithmetic operation with fixed-point numbers; receiving of a user input indicating how a placement of a radix point is to be determined in the plurality of digits representing the result of the arithmetic operation with fixed-point numbers, where: the received user input requests to place the radix point such that a level of precision of the result of the arithmetic operation is preserved, or the received user input requests to place the radix point such that overflow is prevented when storing the result of the arithmetic operation; and calculating a selected fixed-point arithmetic operation, the calculating including: employing one of the word lengths in the plurality of possible word lengths for storing a plurality of digits representing the result of the selected fixed-point arithmetic operation, the employed one of the word lengths in the plurality of possible word lengths being selected based on the request included in the received indication, and determining the placement of the radix point in the plurality of digits representing the result of the selected fixed-point arithmetic operation based on the received user input.
 20. The medium of claim 19, further comprising selecting, responsive to the employed word length, a word length for storing a result of evaluating a subsequent selected fixed-point arithmetic operation.
 21. The medium of claim 19, wherein receiving an indication of a plurality of possible word lengths further comprises receiving a plurality of possible word lengths containing a single word length.
 22. The medium of claim 19, wherein receiving an indication of a plurality of possible word lengths further comprises receiving a plurality of possible word lengths containing a vector of word lengths.
 23. The medium of claim 19, wherein calculating a selected fixed-point arithmetic operation further comprises storing an indicator of the length of used space remaining in the employed word length.
 24. The medium of claim 19, wherein calculating a selected fixed-point arithmetic operation further comprises determining to choose a longer word length for the length of the employed word length.
 25. The medium of claim 19, wherein calculating a selected fixed-point arithmetic operation further comprises determining to store at least one of a plurality of digits representing the result of the selected fixed-point arithmetic operation in a word, the word having a length responsive to the request to preserve the level of precision of the result.
 26. The medium of claim 19, wherein calculating a selected fixed-point arithmetic operation further comprises determining to store most significant digits of the result.
 27. The medium of claim 19, wherein calculating a selected fixed-point arithmetic operation further comprises determining to store least significant digits of the result.
 28. In a computational device, a method for determining attributes for results of arithmetic operations with fixed-point numbers, the method comprising: receiving an indication of a plurality of possible scaling factors to be used in storing a plurality of digits representing a result of an arithmetic operation with fixed-point numbers; receiving user input indicating how a word length is to be determined for a word storing the plurality of digits representing the result of the arithmetic operation with fixed-point numbers, where: the received user input requests to place the radix point such that a level of precision of the result of the arithmetic operation is preserved, or the received user input requests to place the radix point such that overflow is prevented when storing the result of the arithmetic operation; and calculating a selected fixed-point arithmetic operation, the calculating including: employing one of the scaling factors in the plurality of possible scaling factors in storing the plurality of digits representing the result of the selected fixed-point arithmetic operation, the employed one of the scaling factors in the plurality of possible scaling factors being selected based on the request included in the received indication, and determining, using the computational device, the word length for the word storing the plurality of digits representing the result of the selected fixed-point arithmetic operation based on the received user input.
 29. The method of claim 28, wherein receiving an indication of a plurality of possible scaling factors further comprises receiving a plurality of possible scaling factors containing a single scaling factor.
 30. The method of claim 28, wherein receiving an indication of a plurality of possible scaling factors further comprises receiving a plurality of possible scaling factors containing a vector of scaling factors.
 31. The method of claim 28, wherein calculating a selected fixed-point arithmetic operation further comprises the step of determining to store most significant digits of the result.
 32. The method of claim 28, wherein calculating a selected fixed-point arithmetic operation further comprises the step of determining to store least significant digits of the result.
 33. A system comprising: a processor executing instructions for providing: a an indicator of possible scaling factors; a result of evaluating a fixed-point arithmetic operation, the result comprising a plurality of digits; and an evaluation component for: determining a word length for a word storing the plurality of digits representing the result of evaluating the fixed-point arithmetic operation based on a user input, where: the user input requests storing most significant digits of the result in the word, or the user input requests storing least significant digits of the result in the word, and determining to store at least one of the plurality of digits in the word using a scaling factor selected from the possible scaling factors based on the user input.
 34. The system of claim 33 further comprising a user interface receiving the indicator of scaling factor and the result.
 35. The system of claim 34, wherein the user interface further comprises a command line interface.
 36. The system of claim 33, wherein the evaluation component stores an indicator of a number of digits used in the word.
 37. The system of claim 33 further comprising a word having a length selected responsive to a request to preserve a level of precision of the result.
 38. In a computational device, a method for determining attributes to prevent overflow in performing arithmetic operations with fixed-point numbers, the method comprising: receiving a plurality of word lengths to be used when storing a plurality of digits representing a result of an arithmetic operation on at least one operand; receiving information associated with the at least one operand, the information comprising a number of digits used to store, in a first word, a plurality of digits representing the at least one operand; storing the plurality of digits representing the result of evaluating the arithmetic operation on the at least one operand, in a second word having a word length selected from one of the plurality of received word lengths, responsive to the received information, where the word length of the second word is a function of the number of digits used to store, in the first word, the plurality of digits representing the at least one operand; and storing an indicator of the number of digits stored in the second word.
 39. The method of claim 38, wherein the word length of the second word is selected as one of the plurality of word lengths responsive to a determined minimum effective word length.
 40. The method of claim 38, wherein the word length of the second word is selected as one of the plurality of word lengths having a length at least as long as the number of digits used to store the plurality of digits representing the at least one operand.
 41. The method of claim 38, wherein receiving a plurality of word lengths further comprises receiving a plurality of digits representing the at least one operand that are chosen to represent the least significant digits of the operand.
 42. The method of claim 38, wherein receiving a plurality of word lengths further comprises receiving a plurality of digits representing the at least one operand that are chosen to represent the most significant digits of the operand.
 43. The method of claim 38, wherein determining to store the plurality of digits further comprises determining to store the plurality of digits representing the result of evaluating the arithmetic operation on the at least one operand, in a second word having a longer word length than the length needed to store the plurality of digits representing the at least one operand.
 44. The method of claim 38, wherein determining to store the plurality of digits further comprises determining whether the word length of the plurality of digits representing the result of evaluating the arithmetic operation on the at least one operand exceed the length of the longest word length in the received plurality of word lengths.
 45. The method of claim 38, wherein the plurality of digits represents the least significant digits of the result of evaluating the arithmetic operation on the at least one operand.
 46. The method of claim 38, wherein the plurality of digits represents the most significant digits of the result of evaluating the arithmetic operation on the at least one operand.
 47. In a computational device, a method for determining attributes to prevent loss of precision in performing arithmetic operations with fixed-point numbers, the method comprising: receiving a word length to be used for storing fixed-point numbers; receiving a user input requesting to prevent loss of precision when storing a result of evaluating an arithmetic operation with fixed-point numbers; automatically calculating a placement for a minimum radix point in the result of evaluating the arithmetic operation on fixed-point numbers based on the received user input requesting to prevent loss of precision; and storing in a word, responsive to the request to prevent loss of precision, a plurality of digits representing the result of evaluating the arithmetic operation.
 48. The method of claim 47, wherein receiving a word length further comprises receiving a plurality of possible word lengths containing a vector of word lengths.
 49. The method of claim 47, wherein the user input further requests preserving a number of radix places.
 50. In a computational device, a method for determining attributes to prevent overflow when performing arithmetic operations with fixed-point numbers, the method comprising: receiving a word length to be used for storing fixed-point numbers; receiving a user input requesting to prevent overflow when storing a result of evaluating an arithmetic operation with fixed-point numbers; automatically calculating a placement for a maximum radix point in the result of evaluating the arithmetic operation on fixed-point numbers based on the received user input requesting to prevent overflow; and storing in a word, responsive to the request to prevent overflow and to the received word length, a plurality of digits representing the result of evaluating the arithmetic operation.
 51. The method of claim 50, wherein receiving a word length further comprises receiving a plurality of possible word lengths containing a vector of word lengths. 